package com.pearadmin.pro.modules.policy.service.impl;

import java.util.List;
import java.util.ArrayList;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.pearadmin.pro.common.web.base.page.PageResponse;
import com.pearadmin.pro.common.web.base.page.Pageable;

import com.pearadmin.pro.modules.policy.domain.ScrmStuPrePolicy;
import com.pearadmin.pro.modules.policy.param.ScrmStuPrePolicyRequest;
import com.pearadmin.pro.modules.policy.repository.ScrmStuPrePolicyRepository;
import com.pearadmin.pro.modules.policy.service.ScrmStuPrePolicyService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;


/**
 * 签单优惠政策Service业务层处理
 *
 * @author chenJian
 * @date 2021-10-07
 */
@Service
public class ScrmStuPrePolicyServiceImpl extends ServiceImpl<ScrmStuPrePolicyRepository, ScrmStuPrePolicy> implements ScrmStuPrePolicyService
{
    @Resource
    private ScrmStuPrePolicyRepository scrmStuPrePolicyRepository;

    /**
     * 查询签单优惠政策
     * @param request
     * @return 签单优惠政策 分页集合
     * */
    @Override
    public PageResponse<ScrmStuPrePolicy> page(ScrmStuPrePolicyRequest request)
    {
        LambdaQueryWrapper<ScrmStuPrePolicy> query = new LambdaQueryWrapper<ScrmStuPrePolicy>();
        return Pageable.of(request,(()->  scrmStuPrePolicyRepository.selectList(query)));
    }
    /**
     * 保存签单优惠政策
     *
     * @param id 签单优惠政策ID
     * @return 签单优惠政策
     */
    @Override
    public boolean saveOrUpdate(ScrmStuPrePolicy request) {
        return save(request);
    }

    /**
     * 查询签单优惠政策
     *
     * @param id 签单优惠政策ID
     * @return 签单优惠政策
     */
    @Override
    public ScrmStuPrePolicy selectScrmStuPrePolicyById(Long id)
    {
        return scrmStuPrePolicyRepository.selectById(id);
    }

}
